//
//  AboutViewController.m
//  SlothSecondProj
//
//  Created by 焱 孙 on 14-3-22.
//  Copyright (c) 2014年 visionet. All rights reserved.
//

#import "AboutViewController.h"
#import "Utils.h"

@interface AboutViewController ()

@end

@implementation AboutViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self initView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)initView
{
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setTopNavBarTitle:@"关于"];
    
    //左边按钮
    UIButton *btnBack = [Utils buttonWithImageName:[UIImage imageNamed:@"nav_setting"] frame:[Utils getNavLeftBtnFrame:CGSizeMake(100,76)] target:self action:@selector(showSideMenu)];
    [self setLeftBarButton:btnBack];
    //notice num view
    NoticeNumView *noticeNumView = [[NoticeNumView alloc]initWithFrame:CGRectMake(25.5, 6+kStatusBarHeight, 18, 18)];
    [self.view addSubview:noticeNumView];
    
    self.m_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,NAV_BAR_HEIGHT,kScreenWidth,kScreenHeight-NAV_BAR_HEIGHT)];
    self.m_scrollView.backgroundColor = [UIColor clearColor];
    self.m_scrollView.autoresizingMask = NO;
    self.m_scrollView.clipsToBounds = YES;
    [self.view addSubview:self.m_scrollView];
    
    int nHeight = 20;
    self.lblVersionType = [[UILabel alloc]initWithFrame:CGRectMake(0,nHeight, kScreenWidth,25)];
    self.lblVersionType.text = @"梅里埃客服系统";
    self.lblVersionType.font = [UIFont systemFontOfSize:20];
    self.lblVersionType.textAlignment = NSTextAlignmentCenter;
    [self.m_scrollView addSubview:self.lblVersionType];
    nHeight += self.lblVersionType.frame.size.height;
    
    nHeight += 10;
    self.lblVersionNum = [[UILabel alloc]initWithFrame:CGRectMake(0, nHeight, kScreenWidth, 20)];
    self.lblVersionNum.text = [NSString stringWithFormat:@" %@  V%@",@"iPhone版",[Common getAppVersion]];
    self.lblVersionNum.font = [UIFont systemFontOfSize:17];
    self.lblVersionNum.textAlignment = NSTextAlignmentCenter;
    [self.m_scrollView addSubview:self.lblVersionNum];
    nHeight += self.lblVersionNum.frame.size.height;
    
    nHeight += 10;
    self.lblDis = [[UILabel alloc]initWithFrame:CGRectZero];
    self.lblDis.numberOfLines = 0;
    self.lblDis.font = [UIFont systemFontOfSize:14];
    self.lblDis.text = @"梅里埃客服系统 是一款实时在线的全渠道智能客服平台，它将原有的各种分散的多种企业客服沟通渠道如微信、微博、邮件、易信、Webchat等整合起来，将客户的咨询、投诉、报修等需求，通过文字、多媒体信息（图片、音频、视频等）及坐标信息描述等方式为客户提供更精准的客户需求响应，同时配合以工单、知识库、部门协作等方式，及时为客服提供便捷、专业的信息支持，更快速响应、解决客户需求。";
    self.lblDis.textAlignment = NSTextAlignmentLeft;
    self.lblDis.lineBreakMode = NSLineBreakByCharWrapping;
    CGSize size = [Common getStringSize:self.lblDis.text font:self.lblDis.font bound:CGSizeMake(kScreenWidth-20, MAXFLOAT) lineBreakMode:NSLineBreakByCharWrapping];
    self.lblDis.frame = CGRectMake(10, nHeight, kScreenWidth-20, size.height);
    [self.m_scrollView addSubview:self.lblDis];
    nHeight += size.height;
    
    nHeight += 30;
    
    [self.m_scrollView setContentSize:CGSizeMake(kScreenWidth, nHeight+10)];
}

- (void)showSideMenu
{
    [[NSNotificationCenter defaultCenter]postNotificationName:kDrawerOpenLeftSide object:nil];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    [[NSNotificationCenter defaultCenter]postNotificationName:kDrawerAddPanGesture object:nil];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:YES];
    [[NSNotificationCenter defaultCenter]postNotificationName:kDrawerRemovePanGesture object:nil];
}

@end
